import 'package:flutter/material.dart';
import './res/listData.dart';

void main() {
  runApp(
    MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: const Text('你好flutter')),
        body: MyApp(),
      ),
    ),
  );
}

class MyApp extends StatelessWidget {
  List<String> list = [];
  MyApp({super.key}) {
    for (var i = 0; i < listData.length; i++) {
      list.add('我是第${i + 1}条数据');
    }
  }

  @override
  Widget build(BuildContext context) {
    return ListView.builder(
      itemCount: list.length,
      itemBuilder: (context, index) {
        return ListTile(
          title: Text('${list[index]}'),
        );
      },
    );
  }
}
